Python site
このモジュールは初期化中に自動的にインポートされます。
Importing this module will append site-specific paths to the module search path and add a few builtins, unless -S was used.
site.main() 関数の処理は、前部と後部からなる最大で四つまでのディレクトリを構築するところから始まります。
原文 It starts by constructing up to four directories from a head and a tail part.
文字列の組み合わせのことを言っている(TODO)
前部では sys.prefix と sys.exec_prefix を使用します; 空の前部は使われません。
後部では、1つ目は空文字列を使い、2つ目は lib/site-packages (Windows) または lib/pythonX.Y/site-packages (Unix と macOS) を使います。
前部-後部の異なる組み合わせごとに、それが存在しているディレクトリを参照しているかどうかを調べ、存在している場合は sys.path へ追加します。 そして、新しく追加されたパスからパス設定ファイルを検索します。
"pyvenv.cfg" という名前のファイルが上で挙げたディレクトリの 1 つに存在していた場合、 sys.executable, sys.prefix, sys.exec_prefix にはそのディレクトリが設定され、 site-packages もチェックします
python -m site
--user-site
ユーザの site-packages ディレクトリを表示します。
参考